<template>
  <div class="customDetailsTopbar">
    <i class="iconfont pos" @click="back">&#xe600;</i>
    <div class="title">{{ title }}</div>
    <i v-if="showClose" class="iconfont pos1" @click="back">&#xe647;</i>
  </div>
</template>

<script>
export default {
  props: {
    title: {
      type: String,
      default: '安全-传感器详情'
    },
    flag: {
      type: Boolean,
      default: false
    },
    showClose: {
      type: Boolean,
      default: false
    }
  },
  mounted() {},
  methods: {
    back() {
      if (this.flag) {
        this.$emit('back')
      } else {
        this.$router.go(-1)
        this.$emit('back')
      }
    }
  }
}
</script>

<style lang="scss">
.customDetailsTopbar {
  height: 90px;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0 20px;
  flex-shrink: 0;
  .title {
    font-size: 35px;
    font-weight: bold;
    color: #fff;
    padding: 0 20px;
    margin: 0 auto;
  }
  .iconfont {
    font-size: 40px;
    color: #fff;
    &.pos {
      position: absolute;
      left: 30px;
    }
    &.pos1 {
      position: absolute;
      right: 30px;
    }
  }
}
</style>
